<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="en">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="pdm," />










<meta name="description" content="从 mysql 中导出 pdm 步骤记录 mysql 版本：5.7 PowerDesigner 版本：15.2  生成PDM首选导出建表语句，然后打开PowerDesigner， 选择文件-&amp;gt; 反向工程 -&amp;gt; database  设置模型名称，点击确定。点击使用脚本文件，选择对应的建表语句点击确定即可生成 pdm 文件  调整模型在 PDM 空白处右键—–&amp;gt;显示首选项，选择 ta">
<meta name="keywords" content="pdm">
<meta property="og:type" content="article">
<meta property="og:title" content="从数据库中生成pdm">
<meta property="og:url" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;2019&#x2F;01&#x2F;29&#x2F;pdm&#x2F;index.html">
<meta property="og:site_name" content="Longxw">
<meta property="og:description" content="从 mysql 中导出 pdm 步骤记录 mysql 版本：5.7 PowerDesigner 版本：15.2  生成PDM首选导出建表语句，然后打开PowerDesigner， 选择文件-&amp;gt; 反向工程 -&amp;gt; database  设置模型名称，点击确定。点击使用脚本文件，选择对应的建表语句点击确定即可生成 pdm 文件  调整模型在 PDM 空白处右键—–&amp;gt;显示首选项，选择 ta">
<meta property="og:locale" content="en">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;create.png">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;createpdm.jpg">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;colunms.jpg">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;colunms1.jpg">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;script.png">
<meta property="og:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;render.jpg">
<meta property="og:updated_time" content="2020-05-06T03:15:15.595Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https:&#x2F;&#x2F;longxiaowei.github.io&#x2F;images&#x2F;pdm&#x2F;create.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://longxiaowei.github.io/2019/01/29/pdm/"/>





  <title>从数据库中生成pdm | Longxw</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="en">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Longxw</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            About
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://longxiaowei.github.io/2019/01/29/pdm/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="longxiaowei">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Longxw">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">从数据库中生成pdm</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2019-01-29T00:00:00+08:00">
                2019-01-29
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/PowerDesigner/" itemprop="url" rel="index">
                    <span itemprop="name">PowerDesigner</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="从-mysql-中导出-pdm-步骤记录"><a href="#从-mysql-中导出-pdm-步骤记录" class="headerlink" title="从 mysql 中导出 pdm 步骤记录"></a>从 mysql 中导出 pdm 步骤记录</h1><ul>
<li>mysql 版本：5.7</li>
<li>PowerDesigner 版本：15.2</li>
</ul>
<h2 id="生成PDM"><a href="#生成PDM" class="headerlink" title="生成PDM"></a>生成PDM</h2><p>首选导出建表语句，然后打开PowerDesigner， 选择文件-&gt; 反向工程 -&gt; database</p>
<p><img src="/images/pdm/create.png" alt=""></p>
<p>设置模型名称，点击确定。点击使用脚本文件，选择对应的建表语句点击确定即可生成 pdm 文件</p>
<p><img src="/images/pdm/createpdm.jpg" alt=""></p>
<h2 id="调整模型"><a href="#调整模型" class="headerlink" title="调整模型"></a>调整模型</h2><p>在 PDM 空白处右键—–&gt;显示首选项，选择 table—&gt;Advanced, 在弹出界面中选择 Columns, 点击 List columns对应的放大镜图标, 通过上下箭头调整列显示顺序。</p>
<p><img src="/images/pdm/colunms.jpg" alt=""></p>
<p>对应以下顺序，这时候的Name是和Code列一致的，都是显示列名，Name列要替换为注释</p>
<p><img src="/images/pdm/colunms1.jpg" alt=""></p>
<h2 id="替换Name列为中文注释"><a href="#替换Name列为中文注释" class="headerlink" title="替换Name列为中文注释"></a>替换Name列为中文注释</h2><p>点击工具—&gt; Execute Commands—-&gt; Edit/Run Script,执行以下脚本即可</p>
<p><img src="/images/pdm/script.png" alt=""></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line">Option   Explicit   </span><br><span class="line">ValidationMode   =   True   </span><br><span class="line">InteractiveMode   =   im_Batch</span><br><span class="line">Dim blankStr</span><br><span class="line">blankStr   =   Space(1)</span><br><span class="line">Dim   mdl   &apos;   the   current   model  </span><br><span class="line">  </span><br><span class="line">&apos;   get   the   current   active   model   </span><br><span class="line">Set   mdl   =   ActiveModel   </span><br><span class="line">If   (mdl   Is   Nothing)   Then   </span><br><span class="line">      MsgBox   &quot;There   is   no   current   Model &quot;   </span><br><span class="line">ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then   </span><br><span class="line">      MsgBox   &quot;The   current   model   is   not   an   Physical   Data   model. &quot;   </span><br><span class="line">Else   </span><br><span class="line">      ProcessFolder   mdl   </span><br><span class="line">End   If  </span><br><span class="line">  </span><br><span class="line">Private   sub   ProcessFolder(folder)   </span><br><span class="line">On Error Resume Next  </span><br><span class="line">      Dim   Tab   &apos;running     table   </span><br><span class="line">      for   each   Tab   in   folder.tables   </span><br><span class="line">            if   not   tab.isShortcut   then   </span><br><span class="line">                  tab.name   =   tab.comment  </span><br><span class="line">                  Dim   col   &apos;   running   column   </span><br><span class="line">                  for   each   col   in   tab.columns   </span><br><span class="line">                  if col.comment = &quot;&quot; or replace(col.comment,&quot; &quot;, &quot;&quot;)=&quot;&quot; Then</span><br><span class="line">                        col.name = blankStr</span><br><span class="line">                        blankStr = blankStr &amp; Space(1)</span><br><span class="line">                  else  </span><br><span class="line">                        col.name = col.comment   </span><br><span class="line">                  end if  </span><br><span class="line">                  next   </span><br><span class="line">            end   if   </span><br><span class="line">      next  </span><br><span class="line">  </span><br><span class="line">      Dim   view   &apos;running   view   </span><br><span class="line">      for   each   view   in   folder.Views   </span><br><span class="line">            if   not   view.isShortcut   then   </span><br><span class="line">                  view.name   =   view.comment   </span><br><span class="line">            end   if   </span><br><span class="line">      next  </span><br><span class="line">  </span><br><span class="line">      &apos;   go   into   the   sub-packages   </span><br><span class="line">      Dim   f   &apos;   running   folder   </span><br><span class="line">      For   Each   f   In   folder.Packages   </span><br><span class="line">            if   not   f.IsShortcut   then   </span><br><span class="line">                  ProcessFolder   f   </span><br><span class="line">            end   if   </span><br><span class="line">      Next   </span><br><span class="line">end   sub</span><br></pre></td></tr></table></figure>

<h2 id="重新渲染PDM"><a href="#重新渲染PDM" class="headerlink" title="重新渲染PDM"></a>重新渲染PDM</h2><p>点击符号—&gt;自动布局，选择合适的布局模型。</p>
<p><img src="/images/pdm/render.jpg" alt=""></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/pdm/" rel="tag"># pdm</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/01/29/mysql/" rel="next" title="windows中安装mysql-8.0.14">
                <i class="fa fa-chevron-left"></i> windows中安装mysql-8.0.14
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2020/03/16/FastDFS/" rel="prev" title="FastDFS 入门">
                FastDFS 入门 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
  <div id="gitalk-container"></div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">longxiaowei</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/%7C%7Carchive">
              
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">categories</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">9</span>
                  <span class="site-state-item-name">tags</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#从-mysql-中导出-pdm-步骤记录"><span class="nav-number">1.</span> <span class="nav-text">从 mysql 中导出 pdm 步骤记录</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#生成PDM"><span class="nav-number">1.1.</span> <span class="nav-text">生成PDM</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#调整模型"><span class="nav-number">1.2.</span> <span class="nav-text">调整模型</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#替换Name列为中文注释"><span class="nav-number">1.3.</span> <span class="nav-text">替换Name列为中文注释</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#重新渲染PDM"><span class="nav-number">1.4.</span> <span class="nav-text">重新渲染PDM</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">longxiaowei</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  <link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
  <script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
  <div id="gitalk-container"></div>
  <script type="text/javascript">
    var gitalk = new Gitalk({
      clientID: '5431b0eabc608f2fe7e9',
      clientSecret: '064ebe3895d7759300adf5dbb806c2fe80426547',
      repo: 'blog-talk',
      owner: 'longxiaowei',
      admin: ['longxiaowei'],
      id: location.pathname,
      distractionFreeMode: 'false'
    })
    gitalk.render('gitalk-container')
  </script>


  





  

  

  

  
  

  

  

  

</body>
</html>
